﻿using System;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdEdFunctionIO : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdEdFunctionIO(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdEdFunctionIO_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdEdFunctionIO obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdEdFunctionIO()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdEdFunctionIO(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdEdFunctionIO() : this(GlobalsPINVOKE.new_OdEdFunctionIO(), MemoryManager.GetMemoryManager().GetCurrentTransaction() == null)
		{
			MemoryTransaction currentTransaction = MemoryManager.GetMemoryManager().GetCurrentTransaction();
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(new OdEdFunctionIO(this.swigCPtr.Handle, true));
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			this.SwigDirectorConnect();
		}

		public new static OdEdFunctionIO cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdFunctionIO_cast(OdRxObject.getCPtr(pObj));
			OdEdFunctionIO result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdFunctionIO)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdFunctionIO)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdFunctionIO)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdEdFunctionIO_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(this.SwigDerivedClassHasMethod("isA", OdEdFunctionIO.swigMethodTypes1) ? GlobalsPINVOKE.OdEdFunctionIO_isASwigExplicitOdEdFunctionIO(this.swigCPtr) : GlobalsPINVOKE.OdEdFunctionIO_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(this.SwigDerivedClassHasMethod("queryX", OdEdFunctionIO.swigMethodTypes0) ? GlobalsPINVOKE.OdEdFunctionIO_queryXSwigExplicitOdEdFunctionIO(this.swigCPtr, OdRxClass.getCPtr(protocolClass)) : GlobalsPINVOKE.OdEdFunctionIO_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdEdFunctionIO createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdFunctionIO_createObject();
			OdEdFunctionIO result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdFunctionIO)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdFunctionIO)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdFunctionIO)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setParam(OdRxObject pParamObj)
		{
			GlobalsPINVOKE.OdEdFunctionIO_setParam(this.swigCPtr, OdRxObject.getCPtr(pParamObj));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdRxObject param()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdFunctionIO_param(this.swigCPtr);
			OdRxObject result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setResult(OdRxObject pResultObj)
		{
			GlobalsPINVOKE.OdEdFunctionIO_setResult(this.swigCPtr, OdRxObject.getCPtr(pResultObj));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdRxObject result()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdFunctionIO_result(this.swigCPtr);
			OdRxObject result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private void SwigDirectorConnect()
		{
			if (this.SwigDerivedClassHasMethod("queryX", OdEdFunctionIO.swigMethodTypes0))
			{
				this.swigDelegate0 = new OdEdFunctionIO.SwigDelegateOdEdFunctionIO_0(this.SwigDirectorqueryX);
			}
			if (this.SwigDerivedClassHasMethod("isA", OdEdFunctionIO.swigMethodTypes1))
			{
				this.swigDelegate1 = new OdEdFunctionIO.SwigDelegateOdEdFunctionIO_1(this.SwigDirectorisA);
			}
			if (this.SwigDerivedClassHasMethod("setParam", OdEdFunctionIO.swigMethodTypes2))
			{
				this.swigDelegate2 = new OdEdFunctionIO.SwigDelegateOdEdFunctionIO_2(this.SwigDirectorsetParam);
			}
			if (this.SwigDerivedClassHasMethod("param", OdEdFunctionIO.swigMethodTypes3))
			{
				this.swigDelegate3 = new OdEdFunctionIO.SwigDelegateOdEdFunctionIO_3(this.SwigDirectorparam);
			}
			if (this.SwigDerivedClassHasMethod("setResult", OdEdFunctionIO.swigMethodTypes4))
			{
				this.swigDelegate4 = new OdEdFunctionIO.SwigDelegateOdEdFunctionIO_4(this.SwigDirectorsetResult);
			}
			if (this.SwigDerivedClassHasMethod("result", OdEdFunctionIO.swigMethodTypes5))
			{
				this.swigDelegate5 = new OdEdFunctionIO.SwigDelegateOdEdFunctionIO_5(this.SwigDirectorresult);
			}
			GlobalsPINVOKE.OdEdFunctionIO_director_connect(this.swigCPtr, this.swigDelegate0, this.swigDelegate1, this.swigDelegate2, this.swigDelegate3, this.swigDelegate4, this.swigDelegate5);
		}

		private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes)
		{
			MethodInfo method = base.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, methodTypes, null);
			return method.DeclaringType.IsSubclassOf(typeof(OdEdFunctionIO));
		}

		private IntPtr SwigDirectorqueryX(IntPtr protocolClass)
		{
			return OdRxObject.getCPtr(this.queryX((OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(protocolClass, false))).Handle;
		}

		private IntPtr SwigDirectorisA()
		{
			return OdRxClass.getCPtr(this.isA()).Handle;
		}

		private void SwigDirectorsetParam(IntPtr pParamObj)
		{
			this.setParam(Teigha.Core.Helpers.odrxCreateObjectInternal(pParamObj, false));
		}

		private IntPtr SwigDirectorparam()
		{
			return OdRxObject.getCPtr(this.param()).Handle;
		}

		private void SwigDirectorsetResult(IntPtr pResultObj)
		{
			this.setResult(Teigha.Core.Helpers.odrxCreateObjectInternal(pResultObj, false));
		}

		private IntPtr SwigDirectorresult()
		{
			return OdRxObject.getCPtr(this.result()).Handle;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		private OdEdFunctionIO.SwigDelegateOdEdFunctionIO_0 swigDelegate0;

		private OdEdFunctionIO.SwigDelegateOdEdFunctionIO_1 swigDelegate1;

		private OdEdFunctionIO.SwigDelegateOdEdFunctionIO_2 swigDelegate2;

		private OdEdFunctionIO.SwigDelegateOdEdFunctionIO_3 swigDelegate3;

		private OdEdFunctionIO.SwigDelegateOdEdFunctionIO_4 swigDelegate4;

		private OdEdFunctionIO.SwigDelegateOdEdFunctionIO_5 swigDelegate5;

		private static Type[] swigMethodTypes0 = new Type[]
		{
			typeof(OdRxClass)
		};

		private static Type[] swigMethodTypes1 = new Type[0];

		private static Type[] swigMethodTypes2 = new Type[]
		{
			typeof(OdRxObject)
		};

		private static Type[] swigMethodTypes3 = new Type[0];

		private static Type[] swigMethodTypes4 = new Type[]
		{
			typeof(OdRxObject)
		};

		private static Type[] swigMethodTypes5 = new Type[0];

		public delegate IntPtr SwigDelegateOdEdFunctionIO_0(IntPtr protocolClass);

		public delegate IntPtr SwigDelegateOdEdFunctionIO_1();

		public delegate void SwigDelegateOdEdFunctionIO_2(IntPtr pParamObj);

		public delegate IntPtr SwigDelegateOdEdFunctionIO_3();

		public delegate void SwigDelegateOdEdFunctionIO_4(IntPtr pResultObj);

		public delegate IntPtr SwigDelegateOdEdFunctionIO_5();
	}
}
